<!-- include tpl=login/header title=短信登录 -->
<script type="text/javascript">
function check_input()
{
	$("#login_submit").attr("disabled",true);
	var act = $.dialog.tips('正在登录，请稍候…');
	var mobile = $("input[name=mobile]").val();
	if(!mobile){
		$("#login_submit").attr("disabled",false);
		act.close();
		$.dialog.alert('手机号不能为空','','error');
		return false;
	}
	var code = $("input[name=_chkcode]").val();
	if(!code){
		$("#login_submit").attr("disabled",false);
		act.close();
		$.dialog.alert('验证码不能为空','','error');
		return false;
	}
	var url = api_url('login','sms','mobile='+mobile+"&_chkcode="+code);
	$.phpok.json(url,function(rs){
		$("#login_submit").attr("disabled",false);
		act.close();
		if(rs.status){
			var backurl = $("input[name=_back]").val();
			if(!backurl){
				backurl = webroot;
			}
			$.phpok.go(backurl);
			return true;
		}
		$.dialog.alert(rs.info,true,'error');
		return false;
	});
	return false;
}
</script>
<section class="container">
	<div class="row justify-content-center">
		<div class="col col-sm-6 p-4 m-4 bg-white border shadow">
			<form onsubmit="return $.login.sms(this)" method="post">
				<input type="hidden" name="_back" id="_back" value="{$_back}" />
				<div class="form-group">
					<label for="mobile">手机号</label>
					<div class="row">
						<div class="col"><input type="text" class="form-control" id="mobile" name="mobile" placeholder="请输入手机号" /></div>
						<div class="col"><input type="button" value="发送手机验证码" onclick="$.vcode.sms(this,'mobile','login')" class="btn btn-light btn-block btn-sm mt-1" id="mobile_send_status" /></div>
					</div>
				</div>
				<div class="form-group">
					<label for="_chkcode">手机验证码</label>
					<input type="text" name="_vcode" class="form-control" id="_vcode" placeholder="请输入手机上收到的验证码" />
				</div>
				<!-- if $is_vcode -->
				<div class="form-group">
					<label for="_chkcode">验证码 <img src="{#images#}/blank.gif" border="0" align="absmiddle" id="vcode" class="hand" /></label>
					<input type="text" class="form-control" required name="_chkcode" id="_chkcode" placeholder="请输入图片上的字符" />
					
				</div>
				<!-- /if -->
				<div class="form-group">
					<button type="submit" class="btn btn-primary btn-block" id="login_submit">登录</button>
				</div>
				<div class="form-group">
					<a href="{url ctrl=login/}" class="btn btn-light btn-block"><i class="fa fa-user"></i> 账号密码登录</a>
					<!-- if $login_sms || $login_email -->
					<a href="{url ctrl=login func=getpass/}" class="btn btn-light btn-block"><i class="fa fa-location-arrow"></i> 找回密码</a>
					<!-- /if -->
					<a href="{$sys.url}" class="btn btn-light btn-block"><i class="fa fa-home"></i> 网站首页</a>
				</div>
			</form>
		</div>
	</div>
</section>
<!-- include tpl=login/footer -->